package com.ruoyi.common.core.config;

import com.alipay.api.AlipayConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xsj
 * @create 2023-07-29 9:12
 */
@Configuration
public class ZfbPayConfig {

    @Bean("aliConfig")
    public AlipayConfig alipayConfig() {
        AlipayConfig alipayConfig = new AlipayConfig();
        alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
        alipayConfig.setAppId(ZfbConstants.APP_ID);
        alipayConfig.setPrivateKey(ZfbConstants.PRIVATE_KEY);
        alipayConfig.setFormat("json");
        alipayConfig.setCharset("UTF-8");
        alipayConfig.setSignType("RSA2");
        alipayConfig.setAlipayPublicKey(ZfbConstants.ALIPAY_PUBLIC_KEY);
        alipayConfig.setAppCertContent(ZfbConstants.appCertContent);
        alipayConfig.setAlipayPublicCertContent(ZfbConstants.alipayPublicCertContent);
        alipayConfig.setRootCertContent(ZfbConstants.rootCertContent);
        alipayConfig.setEncryptType("AES");
        alipayConfig.setEncryptKey(ZfbConstants.AES);
        return alipayConfig;
    }

}
